FramedTcp handling the nagle algorithm to improve the performance #77
+19
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR handles the Nagle algorithm in
FramedTcp
allowing to send a message immediately without sending partially (whatever possible). In other words: it disabled the algorithm until the message is fully in the OS sending buffer, and then enables it to send the full message without waiting for another possible message.This protocol is message-oriented. This means that receiving less than a message has no meaning for the receiver who needs to wait for the remaining data to produce a meaningful message (which implies allocating in a
Decoder
). For that reason, sending partial data before having the whole message does not improve anything. What's more, it saturates the network.Although this feature implies a latency reduction since once the complete message is OS output buffer it is sent, could also imply an impact on the throughput. Anyway, the user of a
FramedTcp
transport would want latency versus throughput. If throughput is the target, they will probably send big messages that will be less impacted by this change, or even more probably they prefer to chooseTCP
transport that fits better for throughput.NOTE: Conceptually it should work, but how to evaluate this improvement?